<?php
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class AdminUserSeeder extends Seeder
{
    /**
     * 插入后台默认超级管理员，运行时，重置用户为admin,密码为： 123456
     */
    public function run(){
        //删除存在的超级会员
        DB::table('admin_user')->where('is_administrator', '=', 1)->delete();
        //插入超级管理员
        DB::table('admin_user')->insert([
            'name' => 'admin',
            'password' => Hash::make('123456', ['admin', '123456']),
            'is_administrator' => 1,
            'status' => 1,
            'updated_at' => date('Y-m-d H:i:s'),
            'created_at' => date('Y-m-d H:i:s'),
        ]);
    }

}
